<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <meta name="layout" content="main"/>
  <title>Event List</title>
</head>
<body>
<div class="nav">
  <span class="menuButton"><a class="home" href="${createLinkTo(dir: '')}">Home</a></span>
  <span class="menuButton"><g:link class="create" action="create">New Event</g:link></span>
  <g:render template="/common/menubar"/>
  <g:if test="${feedAction}">
    <span class="menuButton"><g:link class="rss" controller="event" action="${feedAction}" params="[format:'xml']"/></span>
  </g:if>
</div>
<div class="body">
  <g:if test="${!listHeader}">
    <h1>Event List</h1>
  </g:if>
  <g:if test="${listHeader}">
    <h1>${listHeader}</h1>
  </g:if>
  <g:if test="${flash.message}">
    <div class="message">${flash.message}</div>
  </g:if>
  <div class="list">
    <table>
      <thead>
      <tr>
        <g:sortableColumn property="name" title="Name"/>
        <g:sortableColumn property="description" title="Description"/>
        <g:sortableColumn property="location" title="Location"/>
        <g:sortableColumn property="startDate" title="Start Date"/>
        <g:sortableColumn property="endDate" title="End Date"/>
      </tr>
      </thead>
      <tbody>
      <g:if test="${eventInstanceList.size() == 0}">
        <tr>
          <td colspan=7>No events found</td>
        </tr>
      </g:if>
      <g:each in="${eventInstanceList}" status="i" var="eventInstance">
        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
          <td><g:link action="showDetails" id="${eventInstance.id}">${fieldValue(bean: eventInstance, field: 'name')}</g:link></td>
          <td>${fieldValue(bean: eventInstance, field: 'description')}</td>
          <td>${fieldValue(bean: eventInstance, field: 'location')}</td>
          <td>${fieldValue(bean: eventInstance, field: 'startDate')}</td>
          <td>${fieldValue(bean: eventInstance, field: 'endDate')}</td>
        </tr>
      </g:each>
      </tbody>
    </table>
  </div>
  %{--<div class="paginateButtons">--}%
  %{--<g:paginate total="${eventInstanceTotal}"/>--}%
  %{--</div>--}%
</div>
</body>
</html>
